<template>
  <div class="center">
    <div class="btn" @click="logout">退出登录</div>
    <div class="btn" @click="wxLogout">解绑微信</div>
  </div>
</template>

<script>
import { logoutWechat } from "../request/httpApi";

export default {
  methods: {
    logout() {
      this.$toast({
        message: "退出成功",
        type: "success",
      });
      localStorage.clear();
      this.$router.push("/index");
      this.$store.state.userInfo = null;
    },
    // 解绑微信
    wxLogout() {
      logoutWechat().then(res => {
        if (res.code === 0) {
          this.$toast({
            message: "微信解绑成功",
            success: "success",
          });
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
.center {
  .btn {
    width: 100px;
    height: 40px;
    line-height: 40px;
    background: #0a328e;
    text-align: center;
    color: #fff;
    border-radius: 5px;
    margin-bottom: 20px;
    cursor: pointer;
    font-size: 18px;
  }
}
</style>
